﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;

namespace DataAccess
{
    public class DBConnection
    {
        private string connectionString = "Data Source=DoTuan-PC;Initial Catalog=pmt_db;Integrated Security=True";
        
        //private string connectionString = @"Server=DoTuan-PC;AttachDbFilename=|DataDirectory|\db\pmt_db.mdf;Database=pmt_db;Trusted_Connection=Yes;"; 
        protected SqlConnection sqlConnection;
        protected SqlCommand sqlCommand;
        protected SqlDataReader sqlDataReader;

        public DBConnection()
        {
            sqlConnection = new SqlConnection(connectionString);
            sqlCommand = new SqlCommand();


        }

        public bool open()
        {
            try
            {
                sqlConnection.Open();
                return true;
            }
            catch
            {
                return false;
            }
        }
        public bool close()
        {
            try
            {
                sqlConnection.Close();
                return true;
            }
            catch
            {
                return false;
            }
        }
        
    }
}
